{{include file="header.html"}}
    <div class="header detail_header">
        <div class="nav">
            <div class="search  return"><a href="javascript:history.go(-1);"></a></div>
            <div class="right">
                <a href="{{$smarty.const.__PROJECT__}}"><img src="{{$smarty.const.__APP__}}images/homeon.png" alt=""></a>
                <a href="javascript:"><img onclick="$('#sub-title').toggle();$('#screenIfmNav').toggle();" src="{{$smarty.const.__APP__}}images/menu.png"></a>
                <ul class="more" id="sub-title">
                    <li><a class="buy-icon" href="javaScript:">云购记录</a></li>
                    <li><a class="help-icon" href="index.php?app=Search">帮助中心</a></li>
                    <li><a class="share" href="javaScript:">分享</a></li>
                </ul>
            </div>
            <div id="screenIfmNav" class="screenIfm" onclick="$('#sub-title').toggle();$(this).hide();"></div>
            <script type="text/javascript">
                var opacity  = 0;
                $(window).scroll(function(){
                    var this_scrollTop = $(this).scrollTop();
                    var header_height = $('.detail_header').height();
                    opacity = this_scrollTop/header_height;
                    if(opacity>1){
                        opacity=1;
                    }
                    if(this_scrollTop>0){
                        $('.detail_header').css('background','rgba(255,255,255,'+opacity+')');
                        $('.detail_header .title').css('opacity',opacity);
                    }else{
                        $('.detail_header').css('background','rgba(255,255,255,0)');
                        $('.detail_header .title').css('opacity',0);
                    }
                });
            </script>
        </div>
    </div>
    <div class="container">
        <div id="focus" class="focus detail_focus">
            <div class="hd"><ul></ul></div>
            <div class="bd">
                <ul>
                    {{if $result.params.image}}
                    {{foreach item=val from=$result.params.image}}
                    <li>
                        <a href="javascript:;">
                            <img _src="{{$val|photo}}"/>
                        </a>
                    </li>
                    {{/foreach}}
                    {{/if}}
                </ul>
            </div>
        </div>
        <script>
            TouchSlide({ 
                slideCell:"#focus",
                titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
                mainCell:".bd ul", 
                effect:"left", 
                // autoPlay:true,//自动播放
                autoPage:true, //自动分页
                switchLoad:"_src" //切换加载，真实图片路径为"_src" 
            });
        </script>
        <div class="detail_base">
            <div class="title">
                <p>{{$result.params.resume}}</p>
            </div>
            <div class="price">价值：￥{{$result.price}}</div>
            <!-- {{if $result.number <= $count.count && $over !='over'}}
            <div class="fullbox">
                <div class="title">揭晓结果即将公布</div>
                <div class="fullicon"></div>
                <div class="countdown">
                    <div class="hms count_down" count-down="{'endTime':'{{$result.rate}}','stopTips':'00:00:00'}" id="hms">
                        
                    </div>
                </div>  
            </div>
            <script type="text/javascript">
                var time = $(".count_down").attr('count-down');
                $(".count_down").countDown(eval('(' + time + ')'));
            </script>
            {{elseif $over !='over'}}
            <div class="linebox">
                <div class="line">
                    <div class="on"></div>
                </div>
                <table>
                    <tr>
                        <td class="fore">{{$count.count}}</td>
                        <td>{{$result.number}}</td>
                        <td class="final">{{$result.number - $count.count}}</td>
                    </tr>
                    <tr>
                        <td>已参与</td>
                        <td>总需人数</td>
                        <td>剩余</td>
                    </tr>
                </table>
            </div>
            {{if !$member.id}}
            <div class="nologin"><a href="javascript:">你还未登录哦，请登陆后再查看吧</a></div>
            {{elseif $count.bought>0}}
            <div class="nologin"><a>您已参与<span style='color:#fe7800;'>{{$count.bought}}</span>人次</a></div>
            {{else}}
            <div class="nologin"><a>您还没有参与哦，试试吧！</a></div>
            {{/if}}
            {{else}}
            <div class="act_end">
                本商品已结束运购
            </div>
            {{/if}} -->
        </div>
        <div class="detailmore">
            <ul>
                <li><a href="index.php?app=Goods&act=goods&id={{$result.id}}">图文详情</a></li>
                <!-- <li><a href="index.php?app=My&act=comment">商品晒单(31)</a></li> -->
            </ul>
        </div>
        <!-- <div class="tabbox">
            <div class="top">
                <div class="tab current"><a href="javascript:"><span>参与记录</span></a></div>
                <div class="tab"><a href="javascript:"><span>历史获得者</span></a></div>
                <div class="clear"></div>
            </div>
            <div class="tabmain">
                <ul>
                    <li>
                        <div class="deps">
                            <img src="{{$smarty.const.__APP__}}images/join.jpg" alt="">
                            <p><span class="nick">今天必中</span>(北京市)</p>
                            <p>2017-04-30 10:06:05.550</p>
                            <div class="num"><span>1</span>人次</div>
                        </div>
                    </li>
                    <li>
                        <div class="deps">
                            <img src="{{$smarty.const.__APP__}}images/join.jpg" alt="">
                            <p><span>今天必中</span>(北京市)</p>
                            <p>2017-04-30 10:06:05.550</p>
                            <div class="num"><span>1</span>人次</div>
                        </div>
                    </li>
                    <li>
                        <div class="deps">
                            <img src="{{$smarty.const.__APP__}}images/join.jpg" alt="">
                            <p><span>今天必中</span>(北京市)</p>
                            <p>2017-04-30 10:06:05.550</p>
                            <div class="num"><span>1</span>人次</div>
                        </div>
                    </li>
                    <li>
                        <div class="deps">
                            <img src="{{$smarty.const.__APP__}}images/join.jpg" alt="">
                            <p><span>今天必中</span>(北京市)</p>
                            <p>2017-04-30 10:06:05.550</p>
                            <div class="num"><span>1</span>人次</div>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="tabmain" style="display:none;">
                <ul>
                    <li>
                        <div class="time"><span>第996云</span><span>揭晓时间</span><span>今天01:24</span></div>
                        
                        <div class="deps prev">
                            <img src="{{$smarty.const.__APP__}}images/join.jpg" alt="">
                            <p>获得者：<span class="get">终于等到你</span>(广东省深圳市)</p>
                            <p>本云参与：<i>1500</i>人次</p>
                            <p>幸运云购码：<i>10005600</i></p>
                        </div>
                    </li>
                    <li>
                        <div class="time"><span>第996云</span><span>揭晓时间</span><span>今天01:24</span></div>
                        
                        <div class="deps prev">
                            <img src="{{$smarty.const.__APP__}}images/join.jpg" alt="">
                            <p>获得者：<span class="get">终于等到你</span>(广东省深圳市)</p>
                            <p>本云参与：<i>1500</i>人次</p>
                            <p>幸运云购码：<i>10005600</i></p>
                        </div>
                    </li>
                    <li>
                        <div class="time"><span>第996云</span><span>揭晓时间</span><span>今天01:24</span></div>
                        
                        <div class="deps prev">
                            <img src="{{$smarty.const.__APP__}}images/join.jpg" alt="">
                            <p>获得者：<span class="get">终于等到你</span>(广东省深圳市)</p>
                            <p>本云参与：<i>1500</i>人次</p>
                            <p>幸运云购码：<i>10005600</i></p>
                        </div>
                    </li>
                    <li>
                        <div class="time"><span>第996云</span><span>揭晓时间</span><span>今天01:24</span></div>
                        
                        <div class="deps prev">
                            <img src="{{$smarty.const.__APP__}}images/join.jpg" alt="">
                            <p>获得者：<span class="get">终于等到你</span>(广东省深圳市)</p>
                            <p>本云参与：<i>1500</i>人次</p>
                            <p>幸运云购码：<i>10005600</i></p>
                        </div>
                    </li>
                </ul>
            </div>
            <script type="text/javascript">
                $(function(){
                    $('.tab').each(function(n){
                        $(this).click(function(){
                            $('.tab').removeClass('current').eq(n).addClass('current');
                            $('.tabmain').hide().eq(n).show();
                        })
                    })
                    var tab_height = $(".tabbox .top").offset().top;
                    $(window).scroll(function(){
                        var this_scrollTop = $(this).scrollTop();
                        var top_height =$(".tabbox .top").innerHeight();
                        if(this_scrollTop>=tab_height-top_height+2 ){
                            // alert('11');
                           $(".tabbox .top").addClass('fix');
                        }else{
                            $(".tabbox .top").removeClass('fix');
                        }
                    });
                })
            </script>
        </div> -->
    </div>
    <!-- inline弹框 -->
    <div style='display:none'>
        <div id='inline_content' style='background:#fff;'>
            <div class="fir">
                <div class="cart">
                    <div class="list">
                        <div class="items">
                            <div class="c_item">
                                <a class="cell1" href="goods.html">
                                    <img class="cart-photo-thumb" alt="" src="{{$val|photo}}">
                                </a>
                                <div class="cell2">
                                    <div class="title">
                                        <a href="detail.html">
                                            {{$result.title}}
                                        </a>
                                    </div>
                                    <div class="cell3">
                                        <span class="shp-cart-item-price" number="{{$result.number}}">
                                            剩余{{$result.number}}人次
                                        </span>
                                    </div>
                                    
                                </div>
                                <div>
                                    <div class="buycount">
                                        <div class="buycount-ctrl">
                                            <a href="javascript:void(0);" class="ctrl minus disabled">
                                                <span class="horizontal">
                                                </span>
                                            </a>
                                            <input class="ooo" value="1" autocomplete="off" type="number" onkeyup='this.value=this.value.replace(/[^0-9]D*$/,"")' ondragenter="return false" onpaste="return !clipboardData.getData('text').match(/D/)" min='1' max='5'>
                                            <a href="javascript:void(0);" class="ctrl plus">
                                                <span class="horizontal">
                                                </span>
                                                <span class="vertical">
                                                </span>
                                            </a>
                                        </div>
                                    </div>
                                    <div class="wastebin"></div>
                                </div>
                            </div>
                        </div>
                        <div class="clear"></div>
                    </div>  
                </div>
                <div class="detailmore goto" href="#inline_content2">
                    <ul>
                        <li><a href="javascript:"><i price="{{$result.price}}">支付宝支付</i><span>￥{{$result.price}}</span></a></li>
                    </ul>
                </div>
                <!-- <div class="cart">
                    <div class="autonew shp-chk-new colorshp">
                        <input type="checkbox" value="1" id="cka" checked="checked">
                        <label class="cart-checkbox" for="cka">
                        </label>
                        <label class="cart-checkbox-text" for="cka">
                            如被抢光自动参与最新一云
                        </label>
                    </div>
                    
                </div> -->
                <div class="paybtn colorbtn">
                    <a href="javascript:">
                        确认支付
                    </a>
                </div>
            </div>
        </div>
    </div>
    <div style='display:none'>
       	<div id='inline_content2' style='background:#fff;'>
            <div class="sec">
                <div class="sec_top inline"href="#inline_content"><i></i>请选择支付方式</div>
                <div class="paytype r_pay">
                    <ul>
                        <li class="r_disabled">
                            
                            <div class="checkbox">
                                <input type="radio" name="payway" value="1" id="ty1" disabled="disabled">
                                
                            </div>
                            <p><i class="ff"></i>福分支付<span>(您的福分20)</span></p>
                            <label for="ty1"></label>
                        </li>
                        <li class="r_disabled">
                            
                            <div class="checkbox">
                                <input type="radio" name="payway" value="1" id="ty2" disabled="disabled">
                                
                            </div>
                            <p><i class="yue"></i>余额支付<span>(账户余额￥0.00)</span></p>
                            <label for="ty2"></label>
                        </li>
                        <li>
                            <div class="checkbox">
                                <input type="radio" name="payway" value="1" id="ty3">
                                
                            </div>
                            <img src="{{$smarty.const.__APP__}}images/icon_pay_wangyin.png" alt="">
                            <div class="clear"></div>
                            <label for="ty3" class='inline' href="#inline_content" pay='1'><div class="txt" >支付宝</div></label>
                        </li>
                        <li>
                    
                            <div class="checkbox">
                                <input type="radio" name="payway" value="1" id="ty5">
                            </div>
                            <img src="{{$smarty.const.__APP__}}images/icon_pay_weixin.png" alt="">
                            <div class="clear"></div>
                            <label for="ty5" class='inline' href="#inline_content" pay='2'><div class="txt">微信支付</div></label>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <form style="display:none" method='post' action='https://pay.paysapi.com'>
    	<input name='price' id='price' type='text' value='{{$result.price}}'/>
        <input name='price_real' type='text' value='{{$result.price}}'/>
        <input name='rate' type='text' value='{{$result.rate}}'/>
		<input name='istype' id='istype' type='text' value='1'/>
        <input name='goodsname' id='goodsname' type='text' value='{{$result.title}}'/>
        <input name='goodsid' id='goodsid' type='text' value='{{$result.id}}'/>
        <input name='address_id'  type='text' value='{{$address_id}}'/>
        <input name='key' id='key' type='text' />
        <input name='notify_url' id='notify_url' type='text' />
        <input name='orderid' id='orderid' type='text' />
        <input name='orderuid' id='orderuid' type='text' />
        <input name='return_url' id='return_url' type='text' />
        <input name='uid' id='uid' type='text' />
        <input type="text" name="total" id="number" value="1">
        <input type="text" name="image" id="image" value="{{$result.image}}">
        <input type="text" name="partake" id="partake" value="{{$result.number - $count.count}}">
        <input type='submit' id='submitdemo1'>
    </form>
    <script type="text/javascript">
        $(document).ready(function(){
            var window_width  = $(window).width();
            if(window_width<720){
                $(".inline").colorbox({inline:true, width:"90%",overlayClose:false,fixed:true});
                $(".goto").colorbox({inline:true, width:"90%",overlayClose:false,fixed:true});
            }else{
                $(".inline").colorbox({inline:true, width:"700px",overlayClose:false,fixed:true});
                $(".goto").colorbox({inline:true, width:"700px",overlayClose:false,fixed:true});
            }
            $('.paytype.r_pay li>label').click(function(){
                var txt = $(this).text();
                var istype = $(this).attr('pay');
                $('.goto li a i').text(txt);
                $('#istype').val(istype);
            })
        });

        $(".plus").click(function(){
        	var total = $(".buycount-ctrl input").val();
        	if(total>4){
        		ui.alert('一人限购5次');
        		return false;
        	}
        	var number = (total*1)+1;
        	price(number);
        })

        $(".minus").click(function(){
        	var total = $(".buycount-ctrl input").val();
        	if(total<=1) return false;
        	var number = (total*1)-1;
        	price(number);
        })

        $(".ooo").change(function(){
        	var total = $(this).val();
        	price(total);
        })

        function price(number){
        	$("#number").val(number);//购买人数
            var surplus = $('.cell3 span').attr('number');//剩余人数
            $('.cell3 span').text("剩余"+((surplus*1)-(number*1))+"人次");
        	var price = $('.goto li a i').attr('price');
        	var total = (number*1)*(price*1);
        	$('#price').val(total);
        	var ex = /^\d+$/;
			if(ex.test(total)) $(".goto li a span").text("￥"+total+".00");
			else $(".goto li a span").text("￥"+total);
        }

        $(".paybtn a").click(function(){
        	var params = $("form").serialize();
			$.post('{{"index.php?app=Goods&act=pays"|URL}}',params,function(data){
				if (data.statusCode == '200'){
                    $("#goodsname").val(data.message.goodsname);
                    $("#istype").val(data.message.istype);
                    $("#key").val(data.message.key);
                    $("#notify_url").val(data.message.notify_url);
                    $("#orderid").val(data.message.orderid);
                    $("#orderuid").val(data.message.orderuid);
                    $("#price").val(data.message.price);
                    $("#return_url").val(data.message.return_url);
                    $("#uid").val(data.message.uid);
                    $('#submitdemo1').click();
                }else if(data.statusCode == '201'){
                	ui.alert(data.message);
                    $.cookie('history_url', window.location.href, {expires: null,path: "/"});
                	setTimeout(function(){
						location.href='{{"index.php?app=Login"|URL}}';
					},1000);
                }else if(data.statusCode == '202'){
                    ui.alert(data.message);
                    $.cookie('history_url', window.location.href, {expires: null,path: "/"});
                    setTimeout(function(){
                        location.href='{{"index.php?app=address&act=modify"|URL}}';
                    },1000);
                }else{
                    ui.error(data.message);
                }
			},"json");
        })
    </script>
    <!-- 底部 -->
    <div class="footer">
        <ul class="wd_nav">
            <dl>
                <dd><a class='inline' href="#inline_content">立即运购</a></dd>
                <dd><a href="javascript:" id="addCart">加入购物车</a></dd>
                <dd><a href="index.php?app=Car"></a></dd>
            </dl>
        </ul>
    </div>
    <script type="text/javascript">
    $("#addCart").click(function(){
        // if($('#addCart').attr("disabled")) return false;
        // $('#addCart').attr("disabled",true);
        var params = $("form").serialize();
        $.post('{{"index.php?app=Car&act=addToCart"|URL}}',params,function(xml){
            if (xml.statusCode == '200'){
                ui.success('加入购物成功！');
                $.cookie('car_number',xml.message,{expires: null,path: "/"});
            }else if(xml.statusCode == '201'){
                ui.alert(xml.message);
                $.cookie('history_url', window.location.href, {expires: null,path: "/"});
                setTimeout(function(){
                    location.href='{{"index.php?app=Login"|URL}}';
                },1000);
            }else if(xml.statusCode == '202'){
                ui.alert(xml.message);
            }else{
                ui.error(xml.message);
            }
        },'json');
    });
    </script>
{{include file="footer.html"}}